package com.inno.subject.common.enums;

import lombok.Getter;

/**
 * 题目难度枚举
 */
@Getter
public enum SubjectLevelEnum {
    //题目难度等级0-入门 1-初级 2-中级 3-高级 4-地狱
    BEGINNER("0", "入门"),
    ELEMENTARY("1", "初级"),
    INTERMEDIATE("2", "中级"),
    ADVANCED("3", "高级"),
    HELL("4", "地狱");

    private final String code;
    private final String desc;

    SubjectLevelEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public static String getDescByCode(String code) {
        for (SubjectLevelEnum item : SubjectLevelEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getDesc();
            }
        }
        return null;
    }
}
